% Klassifikation der Testdaten mittels Perceptron
clear;

X = ones(1,200);

tmp = transpose(load('perceptrondata.dat'));

X(2:3,:) = tmp;

data = load('new_perctarget.mat');
t1 = transpose(data.t1);
t2 = transpose(data.t2);


% Erster Trainingsdurchlauf
w = zeros(
w = perco(X, t1, 1000);

plot(X(2,(t1 == -1)), X(3,(t1 == -1)), 'r.');
hold on;
plot(X(2,(t1 == 1)), X(3,(t1 == 1)), 'b.'); 
hold on;
axis([-1 2 -1 2]);
plot([-1 2],[(w(1)+w(2)*-1)/-w(3) (w(1)+w(2)*2)/-w(3)],'g-');

% Zweiter Trainingsdurchlauf
w = perco(X, t2, 1000);

figure;
plot(X(2,(t2 == -1)), X(3,(t2 == -1)), 'r.');
hold on;
plot(X(2,(t2 == 1)), X(3,(t2 == 1)), 'b.'); 
hold on;
axis([-1 2 -1 2]);
plot([-1 2],[(w(1)+w(2)*-1)/-w(3) (w(1)+w(2)*2)/-w(3)],'g-');